package com.ruoyi.warehouse_zz.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warehouse_zz.domain.WarehouseZz;
import com.ruoyi.warehouse_zz.service.IWarehouseZzService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 仓库信息管理系统Controller
 * 
 * @author zlw
 * @date 2025-06-16
 */
@Controller
@RequestMapping("/warehouse_zz/zz")
public class WarehouseZzController extends BaseController
{
    private String prefix = "warehouse_zz/zz";

    @Autowired
    private IWarehouseZzService warehouseZzService;

    @RequiresPermissions("warehouse_zz:zz:view")
    @GetMapping()
    public String zz()
    {
        return prefix + "/zz";
    }

    /**
     * 查询仓库信息管理系统列表
     */
    @RequiresPermissions("warehouse_zz:zz:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WarehouseZz warehouseZz)
    {
        startPage();
        List<WarehouseZz> list = warehouseZzService.selectWarehouseZzList(warehouseZz);
        return getDataTable(list);
    }

    /**
     * 导出仓库信息管理系统列表
     */
    @RequiresPermissions("warehouse_zz:zz:export")
    @Log(title = "仓库信息管理系统", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WarehouseZz warehouseZz)
    {
        List<WarehouseZz> list = warehouseZzService.selectWarehouseZzList(warehouseZz);
        ExcelUtil<WarehouseZz> util = new ExcelUtil<WarehouseZz>(WarehouseZz.class);
        return util.exportExcel(list, "仓库信息管理系统数据");
    }

    /**
     * 新增仓库信息管理系统
     */
    @RequiresPermissions("warehouse_zz:zz:add")
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存仓库信息管理系统
     */
    @RequiresPermissions("warehouse_zz:zz:add")
    @Log(title = "仓库信息管理系统", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WarehouseZz warehouseZz)
    {
        return toAjax(warehouseZzService.insertWarehouseZz(warehouseZz));
    }

    /**
     * 修改仓库信息管理系统
     */
    @RequiresPermissions("warehouse_zz:zz:edit")
    @GetMapping("/edit/{warehouseId}")
    public String edit(@PathVariable("warehouseId") Long warehouseId, ModelMap mmap)
    {
        WarehouseZz warehouseZz = warehouseZzService.selectWarehouseZzByWarehouseId(warehouseId);
        mmap.put("warehouseZz", warehouseZz);
        return prefix + "/edit";
    }

    /**
     * 修改保存仓库信息管理系统
     */
    @RequiresPermissions("warehouse_zz:zz:edit")
    @Log(title = "仓库信息管理系统", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WarehouseZz warehouseZz)
    {
        return toAjax(warehouseZzService.updateWarehouseZz(warehouseZz));
    }

    /**
     * 删除仓库信息管理系统
     */
    @RequiresPermissions("warehouse_zz:zz:remove")
    @Log(title = "仓库信息管理系统", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(warehouseZzService.deleteWarehouseZzByWarehouseIds(ids));
    }
}
